#include <cstdio>
using namespace std;

int main() {
	int r, b;
	scanf("%d %d", &r, &b);
	int c, d, e;
	long long ans;
	scanf("%d %d %d", &c, &d, &e);
	if (c + d >= e + e) {
		ans = c * r + d * b;
	} else {
		if (r >= b) {
			r -= b;
			ans = 2 * b * e + r * c;
		} else {
			b -= r;
			ans = 2 * r * e + b * d;
		}
	}
	printf("%lld\n", ans);
	return 0;
}